# SPDX-FileCopyrightText: 2025 MounRiver Studio <https://mounriverstudio.com/>
# SPDX-License-Identifier: BSD-3-Clause
# Author: Azolla <https://gitee.com/azolla/>
# Date: 2025-04-21

# Enable CMake support for ASM and C languages
project("hal" VERSION 1.0.0 LANGUAGES C ASM)

message(STATUS "Building hal...")
 
# 创建一个(接口库 INTERFACE)/(静态库 STATIC)/(动态库 SHARED)
add_library(hal STATIC)

# 获取 hal 目录下的所有 .c 文件
file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.c")

# 将这些 .c 文件添加到 hal 库中
target_sources(hal INTERFACE ${SOURCES})

# 添加头文件包含目录，这里假设头文件在当前目录下
target_include_directories(hal PUBLIC 
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_CURRENT_BINARY_DIR}/../include  # 包含 build 目录头文件
)

# 添加链接库(注意：这里需要定义为：PUBLIC)
target_link_libraries(hal PUBLIC driver utils)
if(CONFIG_FREERTOS)
    target_link_libraries(hal PUBLIC FreeRTOS)
endif()

# message(STATUS "Building hal done. ${CMAKE_CURRENT_BINARY_DIR}")